package tw.com.diary.ae.com;

/**
 * 
 * @author Andy
 * 
 */
public class ExceptionUtils {

	/**
	 * 建立訊息資料
	 * 
	 * @param e
	 * @return
	 * @throws DirayBussinessException
	 */
	public static MsgData make(Exception e) throws DirayBussinessException {

		final MsgData data = new MsgData();

		if (e instanceof DirayBussinessException) {

			DirayBussinessException ex = (DirayBussinessException) e;
			data.setMessage(""+ex.getOtherDescirbe());
			data.setTitle("[" + ex.getExCode() + "]" + ex.getExMsg());

		} else {
			data.setMessage(Msg.E0001.exMsg);
			data.setTitle(Msg.E0001.exCode);
		}

		return data;

	}
}
